class Solution:
    def fraction(self, cont):
        cont.reverse()
        s, m = cont[0], 1
        for i in cont[1:]:
            m, s = s, i*s+m
        return [s, m]


if __name__ == "__main__":
    s = Solution()
    print(s.fraction([3, 2, 0, 2]))